import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
//element-icon
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
//引入pinia
import { setupStore, store } from '@/store';
import moment from 'moment';

import i18n from "@/locales/index";

import global from './global';
import './assets/icon/iconfont.css'

async function bootstrap () {
  const app = createApp(App)

  //获取当前环境
  console.log('当前环境', process.env.NODE_ENV);
  // console.log(222, import.meta.env);

  setupStore(app);
  // app.use(store)

  //设置moment语言环境
  moment.locale('zh-cn');
  app.config.globalProperties.$moment = moment

  //icon引入
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
  //国际化
  app.use(i18n);

  app.use(ElementPlus);
  // app.use()
  app.use(router);
  //注册全局内容
  app.use(global);

  app.mount('#app');
}
bootstrap();
